﻿using System.Collections.Specialized;
using SilenthinkContract.Domain;

namespace Web.OAuth.Client
{
    public interface IOAuthClient
    {
        /// <summary>
        /// Friendly name of provider (third-party authentication service). 
        /// Defined by client implementation developer and supposed to be unique.
        /// </summary>
        string ProviderName { get; }

        /// <summary>
        /// Returns URI of service which should be called in order to start authentication process. 
        /// You should use this URI when rendering login link.
        /// </summary>
        string GetLoginUri(string state=null);

        /// <summary>
        /// Obtains user information using third-party authentication service 
        /// using data provided via callback request.
        /// </summary>
        /// <param name="parameters">
        /// Callback request payload (parameters).
        /// <example>Request.QueryString</example>
        /// </param>
        ExternalUser GetUserInfo(NameValueCollection parameters);
    }
}
